
package com.erdos.message.vo.reflection;

import java.lang.reflect.Field;

import com.erdos.common.entity.AbstractEntity;
import com.thoughtworks.xstream.converters.reflection.FieldDictionary;
import com.thoughtworks.xstream.converters.reflection.PureJavaReflectionProvider;

public class ExtendedPureJavaReflectionProvider extends PureJavaReflectionProvider {
	@SuppressWarnings("unchecked")
	private Class omitClass;
	
	public ExtendedPureJavaReflectionProvider() {
		super();
		this.omitClass=AbstractEntity.class;
	}

	public ExtendedPureJavaReflectionProvider(FieldDictionary fieldDictionary) {
		super(fieldDictionary);
		this.omitClass=AbstractEntity.class;
	}
	
	@SuppressWarnings("unchecked")
	public ExtendedPureJavaReflectionProvider(Class omitClass) {
		this.omitClass=omitClass;
	}	

	@Override
	protected boolean fieldModifiersSupported(Field field) {
		return super.fieldModifiersSupported(field) && ! omitClass.equals(field.getDeclaringClass());
	}

}
